package com.lukk.constant;

import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 
 * IndentStatus 下午4:32:15
 * 
 * Copyright zhaocj Inc. All rights reserved. Love ME Like Justin Bieber.
 */
public enum IndentStatus {
	ALREADY_PAID(1, "已付款"), WORKER_SETOUT(6, "已出发"), ORDER_COMPLETED(3, "已完成"), ORDER_UNPAID(5,
			"未付款"), ORDER_TERMINATION(7, "已终止"), ALREADY_CANCELED(8, "已取消");
	// 成员变量
	private final int value;
	private final String codePhrase;

	// 构造方法
	private IndentStatus(int value, String codePhrase) {
		this.value = value;
		this.codePhrase = codePhrase;
	}

	// 普通方法
	public static String getName(int index) {
		for (IndentStatus c : IndentStatus.values()) {
			if (c.getValue() == index) {
				return c.codePhrase;
			}
		}
		return null;
	}

	public static IndentStatus getType(int index) {
		for (IndentStatus c : IndentStatus.values()) {
			if (c.getValue() == index) {
				return c;
			}
		}
		return null;
	}

	public int getValue() {
		return value;
	}

	@JsonValue
	public String getCodePhrase() {
		return codePhrase;
	}

	/**
	 * Return a string representation of this status code.
	 */
	@Override
	public String toString() {
		return this.codePhrase;
	}
}